<template>
  <div class="topBar_wrap flex">
    <div class="text" @click="changePages('/Home')">网易严选</div>
    <div class="secher flex">
      <van-icon name="search" class="icon_sea" />
      <input type="text" placeholder="搜索商品，共147021款好物">
    </div>
    <div class="btn" v-if="!token">
      <button @click="changePages('/login')">登录</button>
    </div>
  </div>
</template>

<script setup lang="ts">
  import { useRouter } from 'vue-router';
  import {ref} from "vue"
  const token = ref(localStorage.getItem('vue_admin_template_token'))
  const router = useRouter()
  const changePages = (url:string) =>{
    
    router.push(url)
  }
</script>

<style scoped lang="less">
.topBar_wrap {
  width: 375px;
  align-items: center;
  position: fixed;
  top: 0;
  padding-left: 5px;
  margin-bottom: 44px;
  background-color: #fff;
  height: 44px;
  z-index: 99;
  .text {
    font-size: 17px;
    font-weight: bolder;
    margin-right: 20px;
  }

  .secher {
    // height: 44px;
    // line-height: 44px;
    align-items: center;
    width: 70%;
    box-sizing: border-box;
    position: relative;
    margin-right: -30px;
   
    .icon_sea {
      position: absolute;
      left: 10px;
      font-size: 16px;
    }

    input {
      height: 24px;
      width: 80%;
      border-radius: 8px;
      background-color: #ededed;
      border: none;
      padding-left: 30px;
      box-sizing: border-box;
      font-size: 12px;
      
      
      &::-webkit-input-placeholder {
        font-size: 12px;
        position: absolute;
        top: 3px;
      }
    }

  }

  .btn {
    height: 44px;
    line-height: 38px;
    position: relative;
    z-index: 22;
    top: 0;
    button {
      height: 22px;
      font-size: 12px;
      line-height: 22px;
      padding: 0 4px;
      color: #dd1a21;
      background-color: #fff;
      border: 1px solid #dd1a21;
      border-radius: 5px;
    }
  }

}
</style>